import React from "react";
import './item.css'
export default class Item extends React.Component {
    constructor(props) {
        super(props);
    } 
    expand(expand) {
        var base = 'item-icon';
        if (expand) {
            base += ' item-icon-roate'
        }
        return base;
    }
    render() {
        var {node, onIcon} = this.props; 
        return <div className="item" style={{ paddingLeft:node.level * 10 + 'px' }}> 
            <div className={this.expand(node.expand)} onClick={()=> onIcon(node)}>
                {  node.children.length ? 'v' : '' }
            </div>
            <div className="text">{node.value}</div> 
        </div>
    }
}
